import {ElMessage} from "element-plus";
import ArkSideTree from "../ark-side-tree/ArkSideTree.vue";
import {ArkSideTreeOptions, TreeData} from "../ark-side-tree/ArkSideTreeOptions";

export default {
  title: 'ark-component-v2/ArkSideTree',
  component: ArkSideTree,
  parameters: {
    docs: {
      description: {
        component: `请配合 <span style="font-weight: bold;font-size: 14px;color: grey">vue3、v3-easyui、typescript、lodash、scss、tailwindcss、ArkScroll、ArkIconFont</span> 使用`
      }
    }
  },
  argTypes: {
    options: {description: 'ArkSideTreeOptions'},
  }
};

const menuTreeData = [
  {
    "id": 1,
    "text": "机构管理",
    "state": "closed",
    "children": [
      {
        "id": 2,
        "text": "区域设置",
        "state": null,
        "children": null
      },
      {
        "id": 3,
        "text": "类别设置",
        "state": null,
        "children": null
      },
      {
        "id": 4,
        "text": "机构设置",
        "state": null,
        "children": null
      },
      {
        "id": 5,
        "text": "用户设置",
        "state": null,
        "children": null
      },
      {
        "id": 103,
        "text": "等级设置",
        "state": null,
        "children": null
      },
      {
        "id": 1120634039701632,
        "text": "机构看板",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 6,
    "text": "学员管理",
    "state": "closed",
    "children": [
      {
        "id": 7,
        "text": "学员维护",
        "state": null,
        "children": null
      },
      {
        "id": 8,
        "text": "密码重置",
        "state": null,
        "children": null
      },
      {
        "id": 9,
        "text": "学员导入",
        "state": null,
        "children": null
      },
      {
        "id": 80,
        "text": "学员照片导入",
        "state": null,
        "children": null
      },
      {
        "id": 1120633724665984,
        "text": "学员信息审核",
        "state": null,
        "children": null
      },
      {
        "id": 1126033047146624,
        "text": "注册学员审核",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 10,
    "text": "信息设置",
    "state": "closed",
    "children": [
      {
        "id": 11,
        "text": "学分大类",
        "state": null,
        "children": null
      },
      {
        "id": 12,
        "text": "项目类型",
        "state": null,
        "children": null
      },
      {
        "id": 13,
        "text": "项目级别",
        "state": null,
        "children": null
      },
      {
        "id": 14,
        "text": "项目形式",
        "state": null,
        "children": null
      },
      {
        "id": 15,
        "text": "项目方式",
        "state": null,
        "children": null
      },
      {
        "id": 16,
        "text": "学分标准",
        "state": null,
        "children": null
      },
      {
        "id": 17,
        "text": "达标标准",
        "state": null,
        "children": null
      },
      {
        "id": 73,
        "text": "项目考核方式设置",
        "state": null,
        "children": null
      },
      {
        "id": 79,
        "text": "业务计算开关设置",
        "state": null,
        "children": null
      },
      {
        "id": 106,
        "text": "西医重要信息设置",
        "state": null,
        "children": null
      },
      {
        "id": 107,
        "text": "注销原因设置",
        "state": null,
        "children": null
      },
      {
        "id": 124,
        "text": "中医重要信息设置",
        "state": null,
        "children": null
      },
      {
        "id": 128,
        "text": "区自管Ⅱ类标准",
        "state": null,
        "children": null
      },
      {
        "id": 137,
        "text": "远程学分分数上限",
        "state": null,
        "children": null
      },
      {
        "id": 1128879298076800,
        "text": "达标总分标准",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 18,
    "text": "项目管理",
    "state": "closed",
    "children": [
      {
        "id": 19,
        "text": "项目维护",
        "state": null,
        "children": null
      },
      {
        "id": 20,
        "text": "I类导入",
        "state": null,
        "children": null
      },
      {
        "id": 21,
        "text": "II类导入",
        "state": null,
        "children": null
      },
      {
        "id": 23,
        "text": "其他导入",
        "state": null,
        "children": null
      },
      {
        "id": 95,
        "text": "II类、其他类学分项目维护",
        "state": null,
        "children": null
      },
      {
        "id": 125,
        "text": "II类项目审核",
        "state": null,
        "children": null
      },
      {
        "id": 138,
        "text": "非项目类项目导入",
        "state": null,
        "children": null
      },
      {
        "id": 1120634296000640,
        "text": "非项目类项目维护",
        "state": null,
        "children": null
      },
      {
        "id": 1120634526589056,
        "text": "区自管项目维护",
        "state": null,
        "children": null
      },
      {
        "id": 1120634987806848,
        "text": "非项目类项目审核",
        "state": null,
        "children": null
      },
      {
        "id": 1120635758420096,
        "text": "项目类项目导入",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 24,
    "text": "学分管理",
    "state": "closed",
    "children": [
      {
        "id": 25,
        "text": "学员学分输入",
        "state": null,
        "children": null
      },
      {
        "id": 26,
        "text": "学分导入",
        "state": null,
        "children": null
      },
      {
        "id": 72,
        "text": "年终学分审核",
        "state": null,
        "children": null
      },
      {
        "id": 74,
        "text": "学分维护\r\n",
        "state": null,
        "children": null
      },
      {
        "id": 77,
        "text": "个人学分导入",
        "state": null,
        "children": null
      },
      {
        "id": 78,
        "text": "达标导入",
        "state": null,
        "children": null
      },
      {
        "id": 108,
        "text": "学分批量导入(学员)",
        "state": null,
        "children": null
      },
      {
        "id": 115,
        "text": "学分审核",
        "state": null,
        "children": null
      },
      {
        "id": 1120633167282304,
        "text": "综合统计",
        "state": null,
        "children": null
      },
      {
        "id": 1120633259122816,
        "text": "综合看板",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 27,
    "text": "基本信息管理",
    "state": "closed",
    "children": [
      {
        "id": 28,
        "text": "学科",
        "state": null,
        "children": null
      },
      {
        "id": 29,
        "text": "职业类别",
        "state": null,
        "children": null
      },
      {
        "id": 30,
        "text": "职称",
        "state": null,
        "children": null
      },
      {
        "id": 31,
        "text": "学历",
        "state": null,
        "children": null
      },
      {
        "id": 32,
        "text": "学位",
        "state": null,
        "children": null
      },
      {
        "id": 33,
        "text": "专业",
        "state": null,
        "children": null
      },
      {
        "id": 116,
        "text": "执业资格",
        "state": null,
        "children": null
      },
      {
        "id": 117,
        "text": "职称段",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 34,
    "text": "下载专区",
    "state": "closed",
    "children": [
      {
        "id": 35,
        "text": "上传",
        "state": null,
        "children": null
      },
      {
        "id": 36,
        "text": "下载",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 37,
    "text": "统计查询",
    "state": "closed",
    "children": [
      {
        "id": 38,
        "text": "组织机构",
        "state": null,
        "children": null
      },
      {
        "id": 39,
        "text": "学员信息",
        "state": null,
        "children": null
      },
      {
        "id": 40,
        "text": "项目信息",
        "state": null,
        "children": null
      },
      {
        "id": 41,
        "text": "学分明细",
        "state": null,
        "children": null
      },
      {
        "id": 42,
        "text": "达标结果",
        "state": null,
        "children": null
      },
      {
        "id": 43,
        "text": "合格证",
        "state": null,
        "children": null
      },
      {
        "id": 44,
        "text": "单位达标",
        "state": null,
        "children": null
      },
      {
        "id": 45,
        "text": "学科达标",
        "state": null,
        "children": null
      },
      {
        "id": 47,
        "text": "类别达标",
        "state": null,
        "children": null
      },
      {
        "id": 49,
        "text": "学历达标",
        "state": null,
        "children": null
      },
      {
        "id": 82,
        "text": "职称达标",
        "state": null,
        "children": null
      },
      {
        "id": 104,
        "text": "等级达标",
        "state": null,
        "children": null
      },
      {
        "id": 105,
        "text": "拟达标率",
        "state": null,
        "children": null
      },
      {
        "id": 130,
        "text": "自查自评表",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 50,
    "text": "信息浏览",
    "state": "closed",
    "children": [
      {
        "id": 54,
        "text": "项目类型浏览",
        "state": null,
        "children": null
      },
      {
        "id": 55,
        "text": "学分授予标准",
        "state": null,
        "children": null
      },
      {
        "id": 58,
        "text": "达标标准浏览",
        "state": null,
        "children": null
      },
      {
        "id": 59,
        "text": "省市区域浏览",
        "state": null,
        "children": null
      },
      {
        "id": 60,
        "text": "机构类别浏览",
        "state": null,
        "children": null
      },
      {
        "id": 96,
        "text": "业务开关浏览",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 62,
    "text": "达标管理",
    "state": "closed",
    "children": [
      {
        "id": 63,
        "text": "达标审核",
        "state": null,
        "children": null
      },
      {
        "id": 64,
        "text": "达标结果查询",
        "state": null,
        "children": null
      },
      {
        "id": 81,
        "text": "达标记录导入",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 65,
    "text": "验证管理",
    "state": "closed",
    "children": [
      {
        "id": 66,
        "text": "合格证审核",
        "state": null,
        "children": null
      },
      {
        "id": 67,
        "text": "合格证代码输入",
        "state": null,
        "children": null
      },
      {
        "id": 68,
        "text": "合格证打印",
        "state": null,
        "children": null
      },
      {
        "id": 109,
        "text": "年中资格审核",
        "state": null,
        "children": null
      },
      {
        "id": 110,
        "text": "年中学分审核",
        "state": null,
        "children": null
      },
      {
        "id": 111,
        "text": "合格结果查询",
        "state": null,
        "children": null
      },
      {
        "id": 1120633520881792,
        "text": "合格证样式管理",
        "state": null,
        "children": null
      },
      {
        "id": 1120633586315392,
        "text": "合格证预览",
        "state": null,
        "children": null
      },
      {
        "id": 1126305269338240,
        "text": "合格证配置",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 69,
    "text": "系统管理",
    "state": "closed",
    "children": [
      {
        "id": 70,
        "text": "角色管理",
        "state": null,
        "children": null
      },
      {
        "id": 71,
        "text": "授权管理",
        "state": null,
        "children": null
      },
      {
        "id": 1120637437657216,
        "text": "用户管理",
        "state": null,
        "children": null
      },
      {
        "id": 1120637569384576,
        "text": "菜单管理",
        "state": null,
        "children": null
      },
      {
        "id": 1120637655253120,
        "text": "项目审核流程配置",
        "state": null,
        "children": null
      },
      {
        "id": 1120637723996288,
        "text": "学分审核流程配置",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 97,
    "text": "西医时间设置",
    "state": "closed",
    "children": [
      {
        "id": 98,
        "text": "系统纪年",
        "state": null,
        "children": null
      },
      {
        "id": 99,
        "text": "学员维护",
        "state": null,
        "children": null
      },
      {
        "id": 100,
        "text": "学分录入",
        "state": null,
        "children": null
      },
      {
        "id": 101,
        "text": "年度验证",
        "state": null,
        "children": null
      },
      {
        "id": 102,
        "text": "合格验证",
        "state": null,
        "children": null
      },
      {
        "id": 126,
        "text": "学分审核",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 118,
    "text": "中医时间设置",
    "state": "closed",
    "children": [
      {
        "id": 119,
        "text": "系统纪年",
        "state": null,
        "children": null
      },
      {
        "id": 120,
        "text": "学员维护",
        "state": null,
        "children": null
      },
      {
        "id": 121,
        "text": "学分录入",
        "state": null,
        "children": null
      },
      {
        "id": 122,
        "text": "年度验证",
        "state": null,
        "children": null
      },
      {
        "id": 123,
        "text": "合格验证",
        "state": null,
        "children": null
      },
      {
        "id": 127,
        "text": "学分审核",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 129,
    "text": "注销学员统计",
    "state": "closed",
    "children": [
      {
        "id": 131,
        "text": "单位查询",
        "state": null,
        "children": null
      },
      {
        "id": 132,
        "text": "学科查询",
        "state": null,
        "children": null
      },
      {
        "id": 133,
        "text": "类别查询",
        "state": null,
        "children": null
      },
      {
        "id": 134,
        "text": "学历查询",
        "state": null,
        "children": null
      },
      {
        "id": 135,
        "text": "职称查询",
        "state": null,
        "children": null
      },
      {
        "id": 136,
        "text": "等级查询",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 140,
    "text": "安全审计",
    "state": "closed",
    "children": [
      {
        "id": 141,
        "text": "用户日志",
        "state": null,
        "children": null
      },
      {
        "id": 142,
        "text": "操作日志",
        "state": null,
        "children": null
      },
      {
        "id": 1120638685945984,
        "text": "学分日志",
        "state": null,
        "children": null
      },
      {
        "id": 1120638759805056,
        "text": "学员日志",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 150,
    "text": "门户管理",
    "state": "closed",
    "children": [
      {
        "id": 151,
        "text": "栏目管理",
        "state": null,
        "children": null
      },
      {
        "id": 152,
        "text": "文章管理",
        "state": null,
        "children": null
      },
    ]
  },
]
const roleTreeData = [
  {
    "id": 1,
    "text": "系统管理员",
  },
  {
    "id": 10,
    "text": "上海市中医继续医学教育委员会",
  },
  {
    "id": 2,
    "text": "上海市继续医学教育委员会",
  },
  {
    "id": 3,
    "text": "市局",
  },
  {
    "id": 4,
    "text": "区局",
  },
  {
    "id": 5,
    "text": "市级医疗卫生机构",
  },
  {
    "id": 6,
    "text": "市中心城区医疗卫生机构",
  },
  {
    "id": 7,
    "text": "郊区县医疗卫生机构",
  },
  {
    "id": 8,
    "text": "科室",
  },
  {
    "id": 9,
    "text": "学员",
  },
  {
    "id": 11,
    "text": "审计",
  },
  {
    "id": 1128835997606016,
    "text": "运营",
  }
]

export const Basic = {
  name: '基本使用',
  render: (args: ArkSideTreeOptions) => ({
    components: {ArkSideTree},
    setup() {
      return {args};
    },
    template: `
      <ArkSideTree v-model:options="args.options" style="height: 500px"/>`,
  }),
  args: {
    options: {
      searchText: '哈哈哈',
      selectOptions: [
        {
          text: "菜单",
          value: "menu",
          defineTreeDataFetch(searchText: string) {
            ElMessage({
              message: '抓取树数据操作1，参数请看控制台打印',
              type: 'success',
            });
            console.log(searchText)

            return Promise.resolve(menuTreeData)
          },
          onNodeSelectChange(nodes: TreeData[]) {
            ElMessage({
              message: '树选中节点改变事件1，参数请看控制台打印',
              type: 'success',
            });
            console.log(nodes)
          },
          afterNodeSelectChange(nodes: TreeData[]) {
            ElMessage({
              message: '树选中节点改变之后1，参数请看控制台打印',
              type: 'success',
            });
            console.log(nodes)
          },
          onNodeExpand(node: TreeData) {
            ElMessage({
              message: '树节点展开事件1，参数请看控制台打印',
              type: 'success',
            });
            console.log(node)
          },
        },
        {
          text: "角色",
          value: "role",
        },
      ],
      defineTreeDataFetch(select: string, searchText: string) {
        ElMessage({
          message: '抓取树数据操作2，参数请看控制台打印',
          type: 'success',
        });
        console.log(select, searchText)

        return Promise.resolve(roleTreeData)
      },
      onNodeSelectChange(nodes: TreeData[]) {
        ElMessage({
          message: '树选中节点改变事件2，参数请看控制台打印',
          type: 'success',
        });
        console.log(nodes)
      },
      afterNodeSelectChange(nodes: TreeData[]) {
        ElMessage({
          message: '树选中节点改变之后2，参数请看控制台打印',
          type: 'success',
        });
        console.log(nodes)
      },
      onNodeExpand(node: TreeData) {
        ElMessage({
          message: '树节点展开事件2，参数请看控制台打印',
          type: 'success',
        });
        console.log(node)
      },
    }
  },
};